package com.example.base.demo.configuration;

import org.springframework.beans.factory.config.PropertiesFactoryBean;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.PropertiesPropertySource;
import org.springframework.stereotype.Component;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @author TangDan
 * @version 1.0
 * @since 2023/3/13
 */
public class MyEnvironmentPostProcessor implements EnvironmentPostProcessor {

    @Override
    public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
/*        try (InputStream inputStream =  new FileInputStream("D:\\my.properties")){
            Properties prop = new Properties();
            prop.load(inputStream);
            PropertiesPropertySource mps = new PropertiesPropertySource("my", prop);
            environment.getPropertySources().addLast(mps);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }*/
    }
}
